package opp.arrayadd;

import java.util.Scanner;

public class SeqSearch {
    public static void main(String[] args) {
        /*
        数组内顺序查找字符串
        1、
        */
        String[] names={"张杰","胡歌","鹿晗","邓紫棋","刘亦菲"};
        System.out.print("请输入名字：");
        Scanner scanner=new Scanner(System.in);
        String Fidname=scanner.next();
        int j=-1;
        for(int i=0;i<names.length;i++)
        {
            if(names[i].equals(Fidname)){
                System.out.println( "恭喜你！找到了姓名为"+ Fidname+"的明星");
                System.out.println( "下标是:  "+ i);
                j=i;
            }
        }if(j==-1)
        {
            System.out.println("姓名为"+Fidname+"的明星没有找到");
        }
    }
}
